var t,
  a = require("../../@babel/runtime/helpers/defineProperty"),
  n = require("../../res/www.a9a.cn.js"),
  i = getApp();
Page({
  data: { mask_class: "alpha0_100", div_hn_btm_box_class: "div_upAnm1" },
  onLoad: function (t) {
    var a = this;
    this.setData({ id: t.id, uid: t.uid, ifhx: t.ifhx }),
      i.get_config("_ZEAI").then(function (t) {
        a.setData({ color: i._ZEAI.color, rgbcolor: n.c16_rgb(i._ZEAI.color) });
      }),
      i.get_navigationBarTopHeight(this),
      i.get_openid().then(function (t) {
        a.init();
      });
  },
  init: function () {
    var a = this;
    (n.ifint(this.data.id) && n.ifint(this.data.uid)) ||
      wx.showModal({
        content: "参数跑路了",
        confirmColor: a.data.color,
        confirmText: "朕知道了",
        showCancel: !1,
        success: function (t) {
          wx.navigateBack();
        },
      }),
      wx.showLoading({ title: "拼命加载中...", mask: !0 });
    var o = {
      submitok: "hn_u",
      openid: (t = wx.getStorageSync("COOK_U")).openid,
      id: this.data.id,
      uid: this.data.uid,
      ifhx: this.data.ifhx,
    };
    i.ajax({
      url: "huxuan.php",
      data: o,
      success: function (t) {
        1 == t.flag
          ? a.setData({
              D: t.D,
              MATE: t.MATE,
              PHOTO: t.PHOTO,
              U: t.U,
              HN: t.HN,
            })
          : "nobm" == t.flag
          ? wx.showModal({
              content: t.msg,
              confirmColor: a.data.color,
              confirmText: "朕知道了",
              showCancel: !1,
              success: function (t) {
                wx.redirectTo({
                  url: "../huxuan/huxuan_detail?id=" + a.data.id,
                });
              },
            })
          : wx.showToast({ title: t.msg, icon: "none", mask: !0 }),
          wx.hideLoading();
      },
    });
  },
  hxFn: function () {
    var a = this;
    i.chklogin().then(function (o) {
      o
        ? wx.showModal({
            title: "",
            content:
              "确定要选择" +
              a.data.D.sex_str +
              "？\r\n选择后将不能更换，请认真对待",
            confirmColor: a.data.color,
            cancelText: "我再想想",
            confirmText: "确定",
            success: function (o) {
              o.confirm &&
                (wx.showLoading({ title: "玩命加载中", mask: !0 }),
                i.ajax({
                  url: "huxuan.php",
                  data: {
                    submitok: "hx_add",
                    openid: t.openid,
                    id: a.data.id,
                    uid: a.data.uid,
                    ifhx: a.data.ifhx,
                  },
                  success: function (t) {
                    1 == t.flag
                      ? wx.showModal({
                          content: t.msg,
                          confirmColor: a.data.color,
                          confirmText: "朕知道了",
                          showCancel: !1,
                          success: function (t) {
                            wx.navigateBack();
                          },
                        })
                      : 0 == t.flag
                      ? wx.showModal({
                          content: t.msg,
                          confirmColor: a.data.color,
                          confirmText: "朕知道了",
                          showCancel: !1,
                          success: function (t) {},
                        })
                      : ((t.this = a), (t.url = "no"), n.sorry(t)),
                      wx.hideLoading();
                  },
                }));
            },
          })
        : (a.setData({ div_login: !0 }), wx.hideLoading());
    });
  },
  mask_closeFn: function (t) {
    var n = this,
      i = t.currentTarget.dataset.maskid;
    this.setData({
      mask_class: "alpha100_0",
      div_hn_btm_box_class: "div_upAnm2",
    }),
      setTimeout(function () {
        var t;
        n.setData(
          (a((t = {}), i, !1),
          a(t, "mask_class", "alpha0_100"),
          a(t, "div_hn_btm_box_class", "div_upAnm1"),
          t)
        );
      }, 500);
  },
  div_hn_btm_closeFn: function () {
    var t = this;
    this.setData({
      mask_class: "alpha100_0",
      div_hn_btm_box_class: "div_upAnm2",
    }),
      setTimeout(function () {
        t.setData({
          div_hn_btm: !1,
          mask_class: "alpha0_100",
          div_hn_btm_box_class: "div_upAnm1",
        });
      }, 500);
  },
  emptyFn: function () {},
  div_hn_btmFn: function () {
    this.setData({ div_hn_btm: !0 });
  },
  div_hn_btm_qxFn: function () {
    var a = this,
      o = this.data.HN.qx_1price_str;
    (o = i.empty(o) ? "" : "\r\n" + o),
      wx.showModal({
        title: "",
        content: "确定委托【" + a.data.HN.hn_truename + "】牵线么？" + o,
        confirmColor: a.data.color,
        cancelText: "我再想想",
        confirmText: "确定",
        success: function (o) {
          o.confirm &&
            i.ajax({
              url: "huxuan.php",
              data: {
                submitok: "div_hn_btm_qx",
                openid: t.openid,
                id: a.data.id,
                uid: a.data.uid,
                ifhx: a.data.ifhx,
                admid: a.data.HN.hn_id,
              },
              success: function (t) {
                1 == t.flag
                  ? wx.showModal({
                      content: t.msg,
                      confirmColor: a.data.color,
                      confirmText: "朕知道了",
                      showCancel: !1,
                      success: function (t) {
                        wx.navigateBack();
                      },
                    })
                  : "qx_1price" == t.flag
                  ? i.pay({
                      data: {
                        submitok: "qx_1price",
                        qx_admid: a.data.HN.hn_id,
                        qx_uid: a.data.uid,
                      },
                      success: function (t) {
                        wx.showToast({ title: t.msg, mask: !0, duration: 3e3 }),
                          setTimeout(function () {
                            a.init();
                          }, 3e3);
                      },
                      fail: function (t) {
                        (t.this = a), (t.url = "no"), n.sorry(t);
                      },
                    })
                  : 0 == t.flag
                  ? wx.showModal({
                      content: t.msg,
                      confirmColor: a.data.color,
                      confirmText: "朕知道了",
                      showCancel: !1,
                      success: function (t) {},
                    })
                  : ((t.this = a), (t.url = "no"), n.sorry(t));
              },
            });
        },
      });
  },
  telFn: function (t) {
    wx.makePhoneCall({ phoneNumber: this.data.HN.kf_tel });
  },
  vipFn: function () {
    var t = this;
    i.chklogin().then(function (a) {
      a
        ? wx.navigateTo({ url: "../my_vip/my_vip" })
        : t.setData({ div_login: !0 });
    });
  },
  certFn: function () {
    var t = this;
    i.chklogin().then(function (a) {
      a ? wx.navigateTo({ url: "../my/cert" }) : t.setData({ div_login: !0 });
    });
  },
  dataFn: function () {
    var t = this;
    i.chklogin().then(function (a) {
      a ? wx.navigateTo({ url: "../reg/reg" }) : t.setData({ div_login: !0 });
    });
  },
  getPhoneNumber: function (t) {
    i.getPhoneNumber({ e: t, url: "../reg/reg", urlkind: "navigateTo" });
  },
  onPageScroll: function (t) {
    t.scrollTop > 100
      ? this.setData({ backtop_flag: !0 })
      : this.setData({ backtop_flag: !1 });
  },
  copyuidFn: function (t) {
    var a = t.currentTarget.dataset.uid;
    n.copy_text({ data: a, msg: "ID编号复制成功" });
  },
  viewFn: function (t) {
    var a = t.currentTarget.dataset.path_b;
    n.empty(a) || wx.previewImage({ current: a, urls: [a] });
  },
  backtopFn: function () {
    wx.pageScrollTo({ scrollTop: 0 });
  },
});
